package edu.uclmgmu.bacteriosec.aspects.fos;

import java.io.FileOutputStream;

import edu.uclmgmu.bacteriosec.aspects.common.Store;

privileged aspect FOS_CountCalls {

	void around(java.io.FileOutputStream f, byte[] b) : target(f) && args(b) &&  call(* FileOutputStream.write(byte[])) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, b);
	}
	
	void around(java.io.FileOutputStream f, byte[] b, int off, int len) : target(f) && args(b, off, len) &&  call(* FileOutputStream.write(byte[], int, int)) {
		int counter=Store.get(thisJoinPointStaticPart.getSignature());
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature(), counter++);
		Store.put(thisJoinPointStaticPart.getSignature(), counter);
		proceed(f, b, off, len);
	}
}
